/**
  ******************************************************************************
  * @file 	zmotors.h 
  * @brief  header file 
  ******************************************************************************
  */

#ifndef __ZBMOTORS_H
#define __ZBMOTORS_H

#include "main.h"

// general defines
#define chNone 	0x00
#define ch1 	0x01
#define ch2 	0x02
#define ch3 	0x04
#define ch4 	0x08
#define ch5 	0x10
#define ch6 	0x20
#define ch7 	0x40
#define ch8 	0x80
#define chAll 	0x0F

#define init 		0x01
#define disable 	0x02
#define newFQ 		0x03
#define newDuty 	0x04

void initPWMOUT(void);
void initPWMOUTGPIO(void);
void updatePWMOUT(void);
void setupPWMOUTDuties(u8 duty[4], u8 channels);
void setPWMOFrequency(u16 frequency);
void testPWMOUT(void); // tests indefinatley

// utility functions
u16 frequencyToPeriod(u16 frequency, u16 *prescalar);
u16 dutyCycleToPulse(u8 duty, u16 period);

#endif
